package com.example.eventlistener.publish;

import com.example.eventlistener.event.MyEvent;
import com.example.eventlistener.event.MyEvent_two;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

/**
 * @Description :
 * @Author : Bruce Lee
 * @CreateTime : 2023/11/21
 */


@Component
public class MyPublish {

    @Autowired
    private ApplicationEventPublisher applicationEventPublisher;

    public void eventPublish(String msg){
        applicationEventPublisher.publishEvent(new MyEvent(this, msg));
    }

    public void eventPublish_two(String msg){
        applicationEventPublisher.publishEvent(new MyEvent_two(this, msg));
    }

}
